﻿///    /************************************************************************ 
///     * uoLib library for .Net projects.
///     * Copyright (c) 2009 by uonun
///     * Homepage: http://uolib.ourome.com
///     * 
///     * This program is free software: you can redistribute it and/or modify
///     * it under the terms of the GNU General Public License as published by
///     * the Free Software Foundation, either version 3 of the License, or
///     * (at your option) any later version.

///     * This program is distributed in the hope that it will be useful,
///     * but WITHOUT ANY WARRANTY; without even the implied warranty of
///     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
///     * GNU General Public License for more details.

///     * You should have received a copy of the GNU General Public License
///     * along with this program.  If not, see http://www.gnu.org/licenses/gpl.html.
///     ***********************************************************************/ 

using System;
using System.Reflection;
namespace uoLib.Web.Debugger
{
    /// <summary>
    /// 异常日志的配置信息
    /// </summary>
    public static class Configuration
    {

        private static string _path = "~/Errors/";
        private static bool _isRecord = true;
        private static LogType _type = LogType.Html;

        /// <summary>
        /// 错误日志的保存路径。默认为"~/Errors/"。
        /// </summary>
        public static string LogPath
        {
            get { return _path; }
            set
            {
                if (string.IsNullOrEmpty(value)) value = "~/Errors/";
                if (!value.EndsWith("/")) { value = value + "/"; }
                _path = value;
            }
        }
        /// <summary>
        /// 是否将捕捉的运行时异常以日志形式保存下来。默认为 true。
        /// </summary>
        public static bool IsRecordErrors { get { return _isRecord; } set { _isRecord = value; } }
        /// <summary>
        /// 错误日志的保存类型
        /// </summary>
        public static LogType LogType { get { return _type; } set { _type = value; } }
    }

    /// <summary>
    /// 异常日志类型
    /// </summary>
    public enum LogType
    {
        /// <summary>
        /// 文本文件
        /// </summary>
        Txt = 0,
        /// <summary>
        /// htm网页文件
        /// </summary>
        Html,
    }
}
